package com.vegetable.modules.service.inbound.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vegetable.modules.entity.inbound.AgentDeliveryDetailPack;
import com.vegetable.modules.mapper.inbound.AgentDeliveryDetailPackMapper;
import com.vegetable.modules.service.inbound.IAgentDeliveryDetailPackService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 入库-代办交货商品包装表 服务实现类
 * </p>
 *
 * @author wangruijie
 * @since 2024-03-07
 */
@Slf4j
@Service
@AllArgsConstructor
public class AgentDeliveryDetailPackServiceImpl extends ServiceImpl<AgentDeliveryDetailPackMapper, AgentDeliveryDetailPack> implements IAgentDeliveryDetailPackService {

    @Override
    public List<AgentDeliveryDetailPack> selectByDetailId(Long detailId) {
        QueryWrapper<AgentDeliveryDetailPack> packQueryWrapper = new QueryWrapper();
        packQueryWrapper.in("detail_id", detailId);
        return this.getBaseMapper().selectList(packQueryWrapper);
    }

    @Override
    public List<AgentDeliveryDetailPack> selectByDetailIds(List<Long> detailIds) {
        QueryWrapper<AgentDeliveryDetailPack> packQueryWrapper = new QueryWrapper();
        packQueryWrapper.in("detail_id", detailIds);
        return this.getBaseMapper().selectList(packQueryWrapper);
    }

    @Override
    public List<AgentDeliveryDetailPack> selectByIds(List<Long> ids) {
        QueryWrapper<AgentDeliveryDetailPack> packQueryWrapper = new QueryWrapper();
        packQueryWrapper.in("id", ids);
        List<AgentDeliveryDetailPack> detailPacks = this.getBaseMapper().selectList(packQueryWrapper);
        return detailPacks;
    }

    @Override
    public void deleteByDetailId(List<Long> detailIds, Integer orderType) {
        QueryWrapper<AgentDeliveryDetailPack> packQueryWrapper = new QueryWrapper();
        packQueryWrapper.in("detail_id", detailIds);
        this.getBaseMapper().delete(packQueryWrapper);
    }
}
